import stackless

from event import Event

import world,display,items

import unittest

class testGold(unittest.TestCase):
    
    def setUp(self):

        self.display=display._Display()
        self.world=world.World(self.display)
        self.gold=items.Gold(self.world,pos=(10,10),value=10)

    def testValue(self):
        '''test the value of Gold'''

        self.assertEqual(self.gold.value,10)

    def testTrigger(self):
        '''testing trigger the event of getting gold'''

        channel=stackless.channel()

        stackless.tasklet(self.gold.picked)(channel)

        self.world.sleepManager.sleep(0.1)
        self.assertEqual(channel.balance,1)
        #event=channel.receive()



unittest.main()
